package com.prac.common.result;

import java.io.Serializable;
import java.util.List;

import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.Singular;

@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
@Builder
public class ListResult<T extends Serializable> extends Result {

    @Singular("add")
    private List<T> list;

    public ListResult(List<T> list) {
        this(0, list);
    }

    public ListResult(int errorCode, List<T> list) {
        if (null == list) {
            super.setCode(errorCode);
        } else {
            this.list = list;
        }
    }

}
